home *** CD-ROM | disk | FTP | other *** search
/ X User Tools / X User Tools (O'Reilly and Associates)(1994).ISO / sun4c / archive / tcltk.z / tcltk / man / catn / for.n < prev    next >
Encoding:
Text File  |  1994-09-20  |  1.5 KB  |  67 lines

  1.  
  2.  
  3.  
  4. for(n)                Tcl Built-In Commands
  5.  
  6.  
  7.  
  8. _________________________________________________________________
  9.  
  10. NAME
  11.      for - ``For'' loop
  12.  
  13. SYNOPSIS
  14.      for _s_t_a_r_t _t_e_s_t _n_e_x_t _b_o_d_y
  15. _________________________________________________________________
  16.  
  17.  
  18. DESCRIPTION
  19.      For is a looping command, similar in structure to the C  for
  20.      statement.   The _s_t_a_r_t, _n_e_x_t, and _b_o_d_y arguments must be Tcl
  21.      command strings, and _t_e_s_t is an expression string.  The  for
  22.      command  first invokes the Tcl interpreter to execute _s_t_a_r_t.
  23.      Then it repeatedly evaluates _t_e_s_t as an expression;  if  the
  24.      result  is  non-zero it invokes the Tcl interpreter on _b_o_d_y,
  25.      then invokes the Tcl interpreter on _n_e_x_t, then  repeats  the
  26.      loop.   The command terminates when _t_e_s_t evaluates to 0.  If
  27.      a continue command is invoked within _b_o_d_y then any remaining
  28.      commands  in the current execution of _b_o_d_y are skipped; pro-
  29.      cessing continues by invoking the Tcl interpreter  on  _n_e_x_t,
  30.      then  evaluating  _t_e_s_t,  and  so  on.  If a break command is
  31.      invoked within _b_o_d_y or  _n_e_x_t,  then  the  for  command  will
  32.      return immediately.  The operation of break and continue are
  33.      similar to the corresponding statements in C.   For  returns
  34.      an empty string.
  35.  
  36.  
  37. KEYWORDS
  38.      for, iteration, looping
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63. Tcl                                                             1
  64.  
  65.  
  66.  
  67.